package method.method1203;

public class work01 {
    public static void main(String[] args) {
        int[] arr={4,6,8,1,2,9};
        reverse(arr);
        for (int i = 0; i < arr.length; i++) {
            System.out.println(arr[i]+" ");
        }
    }
    public static void reverse(int[] arr){
        int temp=0;
        if (arr.length%2==0){
            for (int i = 0; i < arr.length/2; i++) {
                temp=arr[i];
                arr[i]=arr[arr.length-1-i];
                arr[arr.length-1-i]=temp;
            }
        }else if(arr.length%2!=0){
            for (int i = 0; i < (arr.length-1)/2; i++){
                temp=arr[i];
                arr[i]=arr[arr.length-1-i];
                arr[arr.length-1-i]=temp;
            }
        }
    }
}
